﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using com.vs.General;
using com.vs.DataAccess;

namespace com.vs.DataAccess.DO
{
    public partial class ShipmentAllocRequestDO : BaseDO
    {
        #region "Get Model"
        /// <summary>
        /// 将符合数据库主键的持久对象提取到模型对象中，如数据库符合条件的持久对象不存在，则返回空对象
        /// </summary>
        /// <remarks></remarks>
        public static ShipmentAllocRequestDO GetModelByPK(Session sess, double iIntShpAllocNum)
        {
            DataHelper helper = null;
            DataTable dtModel = null;
            StringBuilder sbSQL = null;

            try
            {
                sbSQL = new StringBuilder(SelectSequel).Append(" WHERE INTERNAL_SHIP_ALLOC_NUM = @INTERNAL_SHIP_ALLOC_NUM ");
                helper = new DataHelper(sess);
                dtModel = helper.GetTable(CommandType.Text, sbSQL.ToString(), new IDataParameter[]{
                    DataHelper.BuildParameter(sess, "@INTERNAL_SHIP_ALLOC_NUM", iIntShpAllocNum)
                });
                if (!DataManager.IsEmpty(dtModel))
                {
                    return GetModel(dtModel.Rows[0]);
                }
                else
                {
                    return null;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }

        }

        #endregion

        #region "DataBase Operation"
        /// <summary>
        /// 在数据库里创建该数据访问对象的持久化数据，同时自增长属性INTERNAL_SHIP_ALLOC_NUM也会同时得到更新,并提供数据库事务支持
        /// </summary>
        /// <remarks></remarks>
        public string Insert(Session sess)
        {
            DataHelper helper = null;
            IDataParameter[] paras = null;
            string stSQL = "WAV_IShipmentAllocReq";
            try
            {
                helper = new DataHelper(sess);
                paras = ValueParas(this);
                return "" + helper.GetInt(CommandType.StoredProcedure, stSQL, paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
        }

        public void Delete(Session sess)
        {
            DataHelper helper = null;
            string stSQL = "DELETE FROM SHIPMENT_ALLOC_REQUEST WHERE INTERNAL_SHIP_ALLOC_NUM = @INTERNAL_SHIP_ALLOC_NUM";
            try
            {
                helper = new DataHelper(sess);
                helper.Update(CommandType.Text, stSQL, new IDataParameter[]{
                    DataHelper.BuildParameter(sess, "@INTERNAL_SHIP_ALLOC_NUM", this.INTERNAL_SHIP_ALLOC_NUM)
                });
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }

        }

        /// <summary>
        /// 将该数据访问对象的变化同步到数据库中，如果该数据访问对象在数据库中的持久数据不存在，同步不会发生，同时也不会抛出例外
        /// </summary>
        /// <remarks></remarks>
        public void Update(Session sess)
        {
            DataHelper helper = null;
            string stSQL = "WAV_UShipmentAllocReq";
            try
            {
                helper = new DataHelper(sess);
                helper.Update(CommandType.StoredProcedure, stSQL, ValueParas(this));
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }


        }



        public string Update(Session sess, Dictionary<string, object> dcData)
        {
            DataHelper helper = null;
            StringBuilder sbSQL = null;
            string stSQL = null;
            int i = 0;
            IDataParameter[] paras = null;

            try
            {
                if (dcData.Count < 1)
                    return null;
                helper = new DataHelper(sess);
                sbSQL = new StringBuilder(256)
                            .Append(" UPDATE SHIPMENT_ALLOC_REQUEST SET ");
                paras = new IDataParameter[dcData.Count + 1];
                foreach (KeyValuePair<string, object> kvp in dcData)
                {
                    sbSQL.Append(kvp.Key).Append(" = @Value").Append(i).Append(",");
                    paras[i] = new SqlParameter("@Value" + i, kvp.Value);
                    i++;
                }

                stSQL = sbSQL.ToString();
                stSQL = stSQL.Substring(0, stSQL.Length - 1);

                stSQL = stSQL + " WHERE INTERNAL_SHIP_ALLOC_NUM = @INTERNAL_SHIP_ALLOC_NUM";
                paras[i] = new SqlParameter("@INTERNAL_SHIP_ALLOC_NUM", this.INTERNAL_SHIP_ALLOC_NUM);

                helper.Update(CommandType.Text, stSQL, paras);

                return null;
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
        }
        #endregion

        #region "Data Load"
        /// <summary>
        /// 装载对象SHIPMENALLOCREQUEST的所有持久性对象到集合，如果数据量大，调用此方法会造成性能上的问题，请谨慎使用
        /// </summary>
        /// <remarks></remarks>
        public static List<ShipmentAllocRequestDO> GetAll(Session sess)
        {
            DataHelper helper = null;
            DataTable dtModel = null;
            string stSQL = "SP_SHIPMENALLOCREQUEST_SelectAll";
            try
            {
                helper = new DataHelper(sess);
                dtModel = helper.GetTable(CommandType.StoredProcedure, stSQL);
                return LoadListFromDataView(dtModel.DefaultView);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }

        }

        /// <summary>
        /// 装载指定列的值等于指定值的的所有持久性SHIPMENALLOCREQUEST对象到集合
        /// </summary>
        /// <remarks></remarks>
        public static List<ShipmentAllocRequestDO> GetListByColumn(Session sess, string columnName, Object value, string orderByClause)
        {
            DataTable dtModel = null;

            try
            {
                dtModel = GetTableByColumn(sess, columnName, value, orderByClause);
                if (DataManager.IsEmpty(dtModel))
                    return null;
                return LoadListFromDataView(dtModel.DefaultView);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
            }
        }

        public static List<ShipmentAllocRequestDO> GetListByColumns(Session sess, Dictionary<string, Object> dcParam)
        {
            DataTable dtModel = null;

            try
            {
                dtModel = GetTableByColumns(sess, dcParam);
                return LoadListFromDataView(dtModel.DefaultView);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
            }
        }

        public static DataTable GetTableByColumn(Session sess, string columnName, Object value, string orderByClause)
        {
            DataHelper helper = null;
            IDataParameter[] paras = null;
            string stSQL = null;
            try
            {
                helper = new DataHelper(sess);
                stSQL = SelectSequel + " Where [" + columnName + "] =@Value ";
                if (!StringManager.IsEmpty(orderByClause))
                    stSQL = stSQL + " Order By " + orderByClause;

                paras = new IDataParameter[]{
                    new SqlParameter( "@Value", value)
                };
                return helper.GetTable(CommandType.Text, stSQL, paras);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
        }

        public static DataTable GetTableByColumns(Session sess, Dictionary<string, Object> dcParam)
        {
            DataHelper helper = null;
            StringBuilder sbSQL = null;
            int i = 0;
            IDataParameter[] pars = null;

            try
            {
                helper = new DataHelper(sess);
                sbSQL = new StringBuilder(SelectSequel)
                    .Append(" WHERE 1=1 ");

                pars = new IDataParameter[dcParam.Count];
                foreach (KeyValuePair<string, Object> de in dcParam)
                {
                    if (de.Value != null)
                    {
                        sbSQL.Append(" AND ").Append(de.Key.ToString()).Append(" = @Value").Append(i);
                        pars[i] = new SqlParameter("@Value" + i, de.Value);
                        i++;
                    }
                }
                return helper.GetTable(CommandType.Text, sbSQL.ToString(), pars);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (helper != null)
                    helper.Dispose();
            }
        }

        /// <summary>
        /// 从DataView装载持久性SHIPMENALLOCREQUEST对象到集合
        /// </summary>
        /// <remarks></remarks>
        private static List<ShipmentAllocRequestDO> LoadListFromDataView(DataView dv)
        {
            List<ShipmentAllocRequestDO> list = new List<ShipmentAllocRequestDO>();
            for (int index = 0; index <= dv.Count - 1; index++)
            {
                list.Add(GetModel(dv[index].Row));
            }
            return list;
        }

        /// <summary>
        /// loading data value  to property from Datarow
        /// </summary>
        /// <remarks></remarks>
        public static ShipmentAllocRequestDO GetModel(DataRow row)
        {
            ShipmentAllocRequestDO shpAllocDO = new ShipmentAllocRequestDO();
            if (!row["INTERNAL_SHIP_ALLOC_NUM"].Equals(DBNull.Value)) shpAllocDO.INTERNAL_SHIP_ALLOC_NUM = Convert.ToInt32(row["INTERNAL_SHIP_ALLOC_NUM"]);
            if (!row["INTERNAL_SHIPMENT_LINE_NUM"].Equals(DBNull.Value)) shpAllocDO.INTERNAL_SHIPMENT_LINE_NUM = Convert.ToInt32(row["INTERNAL_SHIPMENT_LINE_NUM"]);
            if (!row["INTERNAL_SHIPMENT_NUM"].Equals(DBNull.Value)) shpAllocDO.INTERNAL_SHIPMENT_NUM = Convert.ToInt32(row["INTERNAL_SHIPMENT_NUM"]);
            if (!row["SHIPMENT_ID"].Equals(DBNull.Value)) shpAllocDO.SHIPMENT_ID = Convert.ToString(row["SHIPMENT_ID"]);
            if (!row["SHIPMENT_TYPE"].Equals(DBNull.Value)) shpAllocDO.SHIPMENT_TYPE = Convert.ToString(row["SHIPMENT_TYPE"]);
            if (!row["PRIORITY"].Equals(DBNull.Value)) shpAllocDO.PRIORITY = Convert.ToInt32(row["PRIORITY"]);
            if (!row["ITEM"].Equals(DBNull.Value)) shpAllocDO.ITEM = Convert.ToString(row["ITEM"]);
            if (!row["COMPANY"].Equals(DBNull.Value)) shpAllocDO.COMPANY = Convert.ToString(row["COMPANY"]);
            if (!row["ITEM_DESC"].Equals(DBNull.Value)) shpAllocDO.ITEM_DESC = Convert.ToString(row["ITEM_DESC"]);
            if (!row["REQUESTED_QTY"].Equals(DBNull.Value)) shpAllocDO.REQUESTED_QTY = Convert.ToInt32(row["REQUESTED_QTY"]);
            if (!row["ALLOCATED_QTY"].Equals(DBNull.Value)) shpAllocDO.ALLOCATED_QTY = Convert.ToInt32(row["ALLOCATED_QTY"]);
            if (!row["QUANTITY_UM"].Equals(DBNull.Value)) shpAllocDO.QUANTITY_UM = Convert.ToString(row["QUANTITY_UM"]);
            if (!row["ATTRIBUTE_NUM"].Equals(DBNull.Value)) shpAllocDO.ATTRIBUTE_NUM = Convert.ToInt32(row["ATTRIBUTE_NUM"]);
            if (!row["CUSTOMER"].Equals(DBNull.Value)) shpAllocDO.CUSTOMER = Convert.ToString(row["CUSTOMER"]);
            if (!row["SHIP_TO"].Equals(DBNull.Value)) shpAllocDO.SHIP_TO = Convert.ToString(row["SHIP_TO"]);
            if (!row["INTERNAL_WAVE_NUM"].Equals(DBNull.Value)) shpAllocDO.INTERNAL_WAVE_NUM = Convert.ToInt32(row["INTERNAL_WAVE_NUM"]);
            if (!row["USER_DEF1"].Equals(DBNull.Value)) shpAllocDO.USER_DEF1 = Convert.ToString(row["USER_DEF1"]);
            if (!row["USER_DEF2"].Equals(DBNull.Value)) shpAllocDO.USER_DEF2 = Convert.ToString(row["USER_DEF2"]);
            if (!row["USER_DEF3"].Equals(DBNull.Value)) shpAllocDO.USER_DEF3 = Convert.ToString(row["USER_DEF3"]);
            if (!row["USER_DEF4"].Equals(DBNull.Value)) shpAllocDO.USER_DEF4 = Convert.ToString(row["USER_DEF4"]);
            if (!row["USER_DEF5"].Equals(DBNull.Value)) shpAllocDO.USER_DEF5 = Convert.ToString(row["USER_DEF5"]);
            if (!row["USER_DEF6"].Equals(DBNull.Value)) shpAllocDO.USER_DEF6 = Convert.ToString(row["USER_DEF6"]);
            if (!row["USER_DEF7"].Equals(DBNull.Value)) shpAllocDO.USER_DEF7 = Convert.ToDouble(row["USER_DEF7"]);
            if (!row["USER_DEF8"].Equals(DBNull.Value)) shpAllocDO.USER_DEF8 = Convert.ToDouble(row["USER_DEF8"]);
            if (!row["USER_STAMP"].Equals(DBNull.Value)) shpAllocDO.USER_STAMP = Convert.ToString(row["USER_STAMP"]);
            if (!row["DATE_TIME_STAMP"].Equals(DBNull.Value)) shpAllocDO.DATE_TIME_STAMP = Convert.ToDateTime(row["DATE_TIME_STAMP"]);
            if (!row["CONVERTED_ALLOC_QTY"].Equals(DBNull.Value)) shpAllocDO.CONVERTED_ALLOC_QTY = Convert.ToInt32(row["CONVERTED_ALLOC_QTY"]);
            if (!row["CONVERTED_QTY_UM"].Equals(DBNull.Value)) shpAllocDO.CONVERTED_QTY_UM = Convert.ToString(row["CONVERTED_QTY_UM"]);
            if (!row["WAREHOUSE"].Equals(DBNull.Value)) shpAllocDO.WAREHOUSE = Convert.ToString(row["WAREHOUSE"]);
            if (!row["FROM_LOC"].Equals(DBNull.Value)) shpAllocDO.FROM_LOC = Convert.ToString(row["FROM_LOC"]);
            if (!row["TO_LOC"].Equals(DBNull.Value)) shpAllocDO.TO_LOC = Convert.ToString(row["TO_LOC"]);
            if (!row["FROM_ZONE"].Equals(DBNull.Value)) shpAllocDO.FROM_ZONE = Convert.ToString(row["FROM_ZONE"]);
            if (!row["TO_ZONE"].Equals(DBNull.Value)) shpAllocDO.TO_ZONE = Convert.ToString(row["TO_ZONE"]);
            if (!row["FROM_TEMPL_FIELD1"].Equals(DBNull.Value)) shpAllocDO.FROM_TEMPL_FIELD1 = Convert.ToString(row["FROM_TEMPL_FIELD1"]);
            if (!row["FROM_TEMPL_FIELD2"].Equals(DBNull.Value)) shpAllocDO.FROM_TEMPL_FIELD2 = Convert.ToString(row["FROM_TEMPL_FIELD2"]);
            if (!row["FROM_TEMPL_FIELD3"].Equals(DBNull.Value)) shpAllocDO.FROM_TEMPL_FIELD3 = Convert.ToString(row["FROM_TEMPL_FIELD3"]);
            if (!row["FROM_TEMPL_FIELD4"].Equals(DBNull.Value)) shpAllocDO.FROM_TEMPL_FIELD4 = Convert.ToString(row["FROM_TEMPL_FIELD4"]);
            if (!row["FROM_TEMPL_FIELD5"].Equals(DBNull.Value)) shpAllocDO.FROM_TEMPL_FIELD5 = Convert.ToString(row["FROM_TEMPL_FIELD5"]);
            if (!row["TO_TEMPL_FIELD1"].Equals(DBNull.Value)) shpAllocDO.TO_TEMPL_FIELD1 = Convert.ToString(row["TO_TEMPL_FIELD1"]);
            if (!row["TO_TEMPL_FIELD2"].Equals(DBNull.Value)) shpAllocDO.TO_TEMPL_FIELD2 = Convert.ToString(row["TO_TEMPL_FIELD2"]);
            if (!row["TO_TEMPL_FIELD3"].Equals(DBNull.Value)) shpAllocDO.TO_TEMPL_FIELD3 = Convert.ToString(row["TO_TEMPL_FIELD3"]);
            if (!row["TO_TEMPL_FIELD4"].Equals(DBNull.Value)) shpAllocDO.TO_TEMPL_FIELD4 = Convert.ToString(row["TO_TEMPL_FIELD4"]);
            if (!row["TO_TEMPL_FIELD5"].Equals(DBNull.Value)) shpAllocDO.TO_TEMPL_FIELD5 = Convert.ToString(row["TO_TEMPL_FIELD5"]);
            if (!row["TASK_CREATED"].Equals(DBNull.Value)) shpAllocDO.TASK_CREATED = Convert.ToString(row["TASK_CREATED"]);
            if (!row["PACKING_CLASS"].Equals(DBNull.Value)) shpAllocDO.PACKING_CLASS = Convert.ToString(row["PACKING_CLASS"]);
            if (!row["TREAT_AS_LOOSE"].Equals(DBNull.Value)) shpAllocDO.TREAT_AS_LOOSE = Convert.ToString(row["TREAT_AS_LOOSE"]);
            if (!row["FROM_LPN"].Equals(DBNull.Value)) shpAllocDO.FROM_LPN = Convert.ToString(row["FROM_LPN"]);
            if (!row["FROM_PARENT_LPN"].Equals(DBNull.Value)) shpAllocDO.FROM_PARENT_LPN = Convert.ToString(row["FROM_PARENT_LPN"]);
            if (!row["INVENTORY_STS"].Equals(DBNull.Value)) shpAllocDO.INVENTORY_STS = Convert.ToString(row["INVENTORY_STS"]);
            if (!row["REPLENISHMENT_REQD"].Equals(DBNull.Value)) shpAllocDO.REPLENISHMENT_REQD = Convert.ToString(row["REPLENISHMENT_REQD"]);

            return shpAllocDO;
        }

        #endregion

        #region "Other function"
        /// <summary>
        /// 该数据访问对象从数据库中提取数据的Sql语句 
        /// </summary>
        /// <remarks></remarks>
        private static string SelectSequel
        {
            get
            {
                return "Select *  From [SHIPMENT_ALLOC_REQUEST] ";
            }
        }

        /// <summary>
        /// 该数据访问对象的属性值装载到数据库更新参数数组
        /// </summary>
        /// <remarks></remarks>
        private static IDbDataParameter[] ValueParas(ShipmentAllocRequestDO shpAllocDO)
        {
            SqlParameter[] paras = new SqlParameter[50];
            paras[0] = new SqlParameter("@INTERNAL_SHIP_ALLOC_NUM", shpAllocDO.INTERNAL_SHIP_ALLOC_NUM);
            paras[1] = new SqlParameter("@INTERNAL_SHIPMENT_LINE_NUM", shpAllocDO.INTERNAL_SHIPMENT_LINE_NUM == 0 ? DBNull.Value : (object)shpAllocDO.INTERNAL_SHIPMENT_LINE_NUM);
            paras[2] = new SqlParameter("@INTERNAL_SHIPMENT_NUM", shpAllocDO.INTERNAL_SHIPMENT_NUM == 0 ? DBNull.Value : (object)shpAllocDO.INTERNAL_SHIPMENT_NUM);
            paras[3] = new SqlParameter("@SHIPMENT_ID", shpAllocDO.SHIPMENT_ID == String.Empty ? DBNull.Value : (object)shpAllocDO.SHIPMENT_ID);
            paras[4] = new SqlParameter("@SHIPMENT_TYPE", shpAllocDO.SHIPMENT_TYPE == String.Empty ? DBNull.Value : (object)shpAllocDO.SHIPMENT_TYPE);
            paras[5] = new SqlParameter("@PRIORITY", shpAllocDO.PRIORITY);
            paras[6] = new SqlParameter("@ITEM", shpAllocDO.ITEM == String.Empty ? DBNull.Value : (object)shpAllocDO.ITEM);
            paras[7] = new SqlParameter("@COMPANY", shpAllocDO.COMPANY == String.Empty ? DBNull.Value : (object)shpAllocDO.COMPANY);
            paras[8] = new SqlParameter("@ITEM_DESC", shpAllocDO.ITEM_DESC == String.Empty ? DBNull.Value : (object)shpAllocDO.ITEM_DESC);
            paras[9] = new SqlParameter("@REQUESTED_QTY", shpAllocDO.REQUESTED_QTY);
            paras[10] = new SqlParameter("@ALLOCATED_QTY", shpAllocDO.ALLOCATED_QTY);
            paras[11] = new SqlParameter("@QUANTITY_UM", shpAllocDO.QUANTITY_UM == String.Empty ? DBNull.Value : (object)shpAllocDO.QUANTITY_UM);
            paras[12] = new SqlParameter("@ATTRIBUTE_NUM", shpAllocDO.ATTRIBUTE_NUM);
            paras[13] = new SqlParameter("@CUSTOMER", shpAllocDO.CUSTOMER == String.Empty ? DBNull.Value : (object)shpAllocDO.CUSTOMER);
            paras[14] = new SqlParameter("@SHIP_TO", shpAllocDO.SHIP_TO == String.Empty ? DBNull.Value : (object)shpAllocDO.SHIP_TO);
            paras[15] = new SqlParameter("@INTERNAL_WAVE_NUM", shpAllocDO.INTERNAL_WAVE_NUM);
            paras[16] = new SqlParameter("@USER_DEF1", shpAllocDO.USER_DEF1 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF1);
            paras[17] = new SqlParameter("@USER_DEF2", shpAllocDO.USER_DEF2 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF2);
            paras[18] = new SqlParameter("@USER_DEF3", shpAllocDO.USER_DEF3 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF3);
            paras[19] = new SqlParameter("@USER_DEF4", shpAllocDO.USER_DEF4 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF4);
            paras[20] = new SqlParameter("@USER_DEF5", shpAllocDO.USER_DEF5 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF5);
            paras[21] = new SqlParameter("@USER_DEF6", shpAllocDO.USER_DEF6 == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_DEF6);
            paras[22] = new SqlParameter("@USER_DEF7", shpAllocDO.USER_DEF7);
            paras[23] = new SqlParameter("@USER_DEF8", shpAllocDO.USER_DEF8);
            paras[24] = new SqlParameter("@USER_STAMP", shpAllocDO.USER_STAMP == String.Empty ? DBNull.Value : (object)shpAllocDO.USER_STAMP);
            paras[25] = new SqlParameter("@DATE_TIME_STAMP", System.DateTime.Now);
            paras[26] = new SqlParameter("@CONVERTED_ALLOC_QTY", shpAllocDO.CONVERTED_ALLOC_QTY);
            paras[27] = new SqlParameter("@CONVERTED_QTY_UM", shpAllocDO.CONVERTED_QTY_UM == String.Empty ? DBNull.Value : (object)shpAllocDO.CONVERTED_QTY_UM);
            paras[28] = new SqlParameter("@WAREHOUSE", shpAllocDO.WAREHOUSE == String.Empty ? DBNull.Value : (object)shpAllocDO.WAREHOUSE);
            paras[29] = new SqlParameter("@FROM_LOC", shpAllocDO.FROM_LOC == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_LOC);
            paras[30] = new SqlParameter("@TO_LOC", shpAllocDO.TO_LOC == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_LOC);
            paras[31] = new SqlParameter("@FROM_ZONE", shpAllocDO.FROM_ZONE == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_ZONE);
            paras[32] = new SqlParameter("@TO_ZONE", shpAllocDO.TO_ZONE == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_ZONE);
            paras[33] = new SqlParameter("@FROM_TEMPL_FIELD1", shpAllocDO.FROM_TEMPL_FIELD1 == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_TEMPL_FIELD1);
            paras[34] = new SqlParameter("@FROM_TEMPL_FIELD2", shpAllocDO.FROM_TEMPL_FIELD2 == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_TEMPL_FIELD2);
            paras[35] = new SqlParameter("@FROM_TEMPL_FIELD3", shpAllocDO.FROM_TEMPL_FIELD3 == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_TEMPL_FIELD3);
            paras[36] = new SqlParameter("@FROM_TEMPL_FIELD4", shpAllocDO.FROM_TEMPL_FIELD4 == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_TEMPL_FIELD4);
            paras[37] = new SqlParameter("@FROM_TEMPL_FIELD5", shpAllocDO.FROM_TEMPL_FIELD5 == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_TEMPL_FIELD5);
            paras[38] = new SqlParameter("@TO_TEMPL_FIELD1", shpAllocDO.TO_TEMPL_FIELD1 == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_TEMPL_FIELD1);
            paras[39] = new SqlParameter("@TO_TEMPL_FIELD2", shpAllocDO.TO_TEMPL_FIELD2 == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_TEMPL_FIELD2);
            paras[40] = new SqlParameter("@TO_TEMPL_FIELD3", shpAllocDO.TO_TEMPL_FIELD3 == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_TEMPL_FIELD3);
            paras[41] = new SqlParameter("@TO_TEMPL_FIELD4", shpAllocDO.TO_TEMPL_FIELD4 == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_TEMPL_FIELD4);
            paras[42] = new SqlParameter("@TO_TEMPL_FIELD5", shpAllocDO.TO_TEMPL_FIELD5 == String.Empty ? DBNull.Value : (object)shpAllocDO.TO_TEMPL_FIELD5);
            paras[43] = new SqlParameter("@TASK_CREATED", shpAllocDO.TASK_CREATED == String.Empty ? DBNull.Value : (object)shpAllocDO.TASK_CREATED);
            paras[44] = new SqlParameter("@PACKING_CLASS", shpAllocDO.PACKING_CLASS == String.Empty ? DBNull.Value : (object)shpAllocDO.PACKING_CLASS);
            paras[45] = new SqlParameter("@TREAT_AS_LOOSE", shpAllocDO.TREAT_AS_LOOSE == String.Empty ? DBNull.Value : (object)shpAllocDO.TREAT_AS_LOOSE);
            paras[46] = new SqlParameter("@FROM_LPN", shpAllocDO.FROM_LPN == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_LPN);
            paras[47] = new SqlParameter("@FROM_PARENT_LPN", shpAllocDO.FROM_PARENT_LPN == String.Empty ? DBNull.Value : (object)shpAllocDO.FROM_PARENT_LPN);
            paras[48] = new SqlParameter("@INVENTORY_STS", shpAllocDO.INVENTORY_STS == String.Empty ? DBNull.Value : (object)shpAllocDO.INVENTORY_STS);
            paras[49] = new SqlParameter("@REPLENISHMENT_REQD", shpAllocDO.REPLENISHMENT_REQD == string.Empty ? DBNull.Value : (object)shpAllocDO.REPLENISHMENT_REQD);


            paras[0].DbType = DbType.Decimal;
            paras[1].DbType = DbType.Decimal;
            paras[2].DbType = DbType.Decimal;
            paras[3].DbType = DbType.String;
            paras[4].DbType = DbType.String;
            paras[5].DbType = DbType.Decimal;
            paras[6].DbType = DbType.String;
            paras[7].DbType = DbType.String;
            paras[8].DbType = DbType.String;
            paras[9].DbType = DbType.Decimal;
            paras[10].DbType = DbType.Decimal;
            paras[11].DbType = DbType.String;
            paras[12].DbType = DbType.String;
            paras[13].DbType = DbType.String;
            paras[14].DbType = DbType.String;
            paras[15].DbType = DbType.Decimal;
            paras[16].DbType = DbType.String;
            paras[17].DbType = DbType.String;
            paras[18].DbType = DbType.String;
            paras[19].DbType = DbType.String;
            paras[20].DbType = DbType.String;
            paras[21].DbType = DbType.String;
            paras[22].DbType = DbType.Decimal;
            paras[23].DbType = DbType.Decimal;
            paras[24].DbType = DbType.String;
            paras[25].DbType = DbType.Date;
            paras[26].DbType = DbType.Decimal;
            paras[27].DbType = DbType.String;
            paras[28].DbType = DbType.String;
            paras[29].DbType = DbType.String;
            paras[30].DbType = DbType.String;
            paras[31].DbType = DbType.String;
            paras[32].DbType = DbType.String;
            paras[33].DbType = DbType.String;
            paras[34].DbType = DbType.String;
            paras[35].DbType = DbType.String;
            paras[36].DbType = DbType.String;
            paras[37].DbType = DbType.String;
            paras[38].DbType = DbType.String;
            paras[39].DbType = DbType.String;
            paras[40].DbType = DbType.String;
            paras[41].DbType = DbType.String;
            paras[42].DbType = DbType.String;
            paras[43].DbType = DbType.String;
            paras[44].DbType = DbType.String;
            paras[45].DbType = DbType.String;
            paras[46].DbType = DbType.String;
            paras[47].DbType = DbType.String;
            paras[48].DbType = DbType.String;
            paras[49].DbType = DbType.String;


            return paras;
        }

        private IDbDataParameter[] WherePara()
        {
            SqlParameter[] paras = new SqlParameter[1];
            paras[0] = new SqlParameter("@INTERNAL_SHIP_ALLOC_NUM", this.INTERNAL_SHIP_ALLOC_NUM);
            return paras;
        }

        #endregion

    }
}
